﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UIWindow.Helper;
using UIWindow.Lucifer;

namespace UIWindow.Protocols.C_Mode
{
    public abstract class OmronCModeBase : IProtocol
    {
        public int Length { get; set; }
        protected StringBuilder _stringBuilder;
        public OmronCModeBase()
        {
            _stringBuilder = new StringBuilder("@");
        }

        public virtual byte[] GetStream()
        {
            string fcs = _stringBuilder.ToString();
            _stringBuilder.Append(fcs.FCS());
            _stringBuilder.Append("*\r");
            return Encoding.ASCII.GetBytes(_stringBuilder.ToString().ToUpper());
        }

        public IProtocol Handle(byte[] bytes)
        {
            return this;
        }
    }
}
